// 章 路由

const router = require("koa-router")()

const {
    chapterApi
} = require("../../../controller/catalogue/chapter")

const {
    check
} = require("../../../middleware/routercheck")

const { veri } = require("../../../middleware/checkData")


router.get(
    "/chapter/byid/:id",
    veri(["id"], "Non empty", "params"),
    veri([ "pageNum", 'pageSize'], 'Non empty', 'query'),
    check("getchapter"),
    chapterApi)
router.get(
    "/chapter/list",
    veri(["pageNum", "pageSize"], "Non empty", "query"),
    check("getchapter"),
    chapterApi)
router.get(
    "/chapter/all",
    check("getchapter"),
    chapterApi)
router.post(
    "/chapter/add",
    veri(["title", "catalogue_id"], "Non empty", "request"),
    check("createchapter"),
    chapterApi)
router.put(
    "/chapter/edit/:id",
    veri(["id"], "Non empty", "params"),
    check("editchapter"),
    chapterApi)
router.delete(
    "/chapter/remove/:id",
    veri(["id"], "Non empty", "params"),
    check("removechapter"),
    chapterApi)


module.exports = router